<?php $this->set('title', 'Group Results'); ?>
<?php $this->set('external_css', array('presenter.css')); ?>
<?php $session->flash();?>

<!-- Survey Results Links -->
<b>Survey Results</b><br />
<?php echo $html->link("Individual", array('controller' => 'presenters', 'action' => 'search_audience')); ?> | 
<?php echo $html->link("Group", array('controller' => 'presenters', 'action' => 'group_results')); ?>

<div class="header">Search For a Survey</div>

<!-- Presenter Search -->
<?php echo $this->element('presenter_search',
				array("controller" => "Presenters", "action" => "group_results"));?>

<table style="" cellpadding="5" cellspacing="0" border="0">
	<tr>
		<td><?php echo $paginator->sort('Name', 'name'); ?></td>
		<td><?php echo $paginator->sort('Unique ID', 'uuid'); ?></td>
		<td><?php echo $paginator->sort('Survey Type', 'SurveyType.type'); ?></td>
		<td><?php echo $paginator->sort('Created', 'created'); ?></td>
		<td><?php echo $paginator->sort('Modified', 'modified'); ?></td>
		<td style="color:Blue"><?php echo 'Results'; ?></td>
		<td>&nbsp;</td>
	</tr>
	<?php foreach ($surveys as $survey): ?>
		<tr>
			<td><?php echo $survey['Survey']['name']; ?></td>
			<td><?php echo substr($survey['Survey']['uuid'],1,8); ?></td>
			<td><?php echo $survey['SurveyType']['type']; ?></td>
			<td><?php echo date("m/d/y g:i A", strtotime($survey['Survey']['created'])); ?></td>
			<td><?php echo date("m/d/y g:i A", strtotime($survey['Survey']['modified'])); ?></td>
			<td>
				<?php echo $html->image('chart.gif', array(
				    "alt" => 'View Results',
    				'url' => array('controller' => 'presenters', 'action' => 'show_survey_results', '0' => $survey['Survey']['id'])
				)) ?>
		 	</td>
		</tr>
	<?php endforeach; ?>
		<tr>
			<!-- Pagination -->
			<td colspan="3">
				<!-- Shows the next and previous links -->
				<?php
					echo $paginator->prev('« Previous ', null, null, array('class' => 'disabledPageLink'));
					echo $paginator->next(' Next »', null, null, array('class' => 'disabledPageLink'));
				?>
				<br />
				<!-- prints X of Y, where X is current page and Y is number of pages -->
				<?php echo $paginator->counter(); ?>
			</td>
		</tr>
</table>